package cn.webrx;

import java.io.File;

public class Dir4 {
    public static void main(String[] args) {
        //遍历目录
        String path = "D:\\abcxx";
        File file = new File(path);
        File[] fs = file.listFiles();
        for(File t : fs){
            //System.out.println(t.isFile());
            //System.out.println(t.isDirectory());
            //System.out.println(t.getAbsoluteFile());
            String info = String.format("%s:%s",t.isDirectory()?"目录":"文件",t.getAbsoluteFile());
            System.out.println(info);
        }

        System.out.println("-------------------");
        String[] fs2 = file.list();
        for(String t : fs2){
            File tf = new File("d:\\abcxx",t);
            System.out.println(tf.isFile());
            System.out.println(tf.isDirectory());
            System.out.println(tf.getAbsoluteFile());
            System.out.println(t);
        }
    }
}
